/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rlpw.swing.table;

import java.awt.Component;
import java.text.DateFormat;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author weinpau
 */
public class DateCellRenderer extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
            int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

        if (value instanceof java.util.Date) {
            String strDate = DateFormat.getDateInstance().format((java.util.Date) value);

            this.setText(strDate);
        }

        return this;
    }
}
